import {getSid, getToken} from '@/utils/auth'
import urlparam from "@/api/ps_form.js"
import qs from 'qs'

export default {
  exportExcel: function (config, param) {
    // 获取url
    let url = urlparam.realUrl(config, '');
    if (param != null && param != '') {
      param = qs.stringify(param);
      url += (url.indexOf("?") == -1 ? "?" : "&")+param;
    }
    let token = getToken();
    let sid = getSid();
    if (url.indexOf("token") == -1) {
      url += (url.indexOf("?") == -1 ? "?" : "&") + "token=" + token + "&_SID=" + sid;
    }
    window.open(url, "_blank")
  }
}
